home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-01 / wtek0693.zip / OOPALLEY.ZIP / LOOKUPKE.CPP < prev    next >
C/C++ Source or Header  |  1993-04-27  |  979b  |  46 lines

  1. #include "lookupke.h"
  2.  
  3. #define THIS    LookupKey
  4. #define BASE    Object
  5. DEFINE_CLASS(LookupKey,Object);
  6.  
  7. LookupKey::LookupKey(const Object& newKey)
  8. {
  9.     akey = (Object*)&newKey;
  10. }
  11.  
  12. Object* LookupKey::key() const   { return akey; }
  13.  
  14. Object* LookupKey::key(const Object& newkey)
  15. {
  16.     Object* temp = akey;
  17.     akey = (Object*)&newkey;
  18.     return temp;
  19. }
  20.  
  21. bool LookupKey::isEqual(const Object& ob) const { return ob.isEqual(*akey); }
  22.  
  23. unsigned LookupKey::hash() const { return akey->hash(); }
  24.  
  25. int LookupKey::compare(const Object& ob) const { return ob.compare(*akey); }
  26.  
  27. void LookupKey::deepenShallowCopy()
  28. {
  29.     akey = akey->deepCopy();
  30. }
  31.  
  32. void LookupKey::printOn(ostream& strm) const
  33. {
  34.     akey->printOn(strm);
  35. }
  36.  
  37. Object* LookupKey::value() const
  38. {
  39.     derivedClassResponsibility("value"); return (Object*)0;
  40. }
  41.  
  42. Object* LookupKey::value(const Object& newvalue)
  43. {
  44.     derivedClassResponsibility("value"); return (Object*)&newvalue;
  45. }
  46.